import {createRouter,createMemoryHistory} from 'vue-router'

//引入页面
const Login = () => import("../views/Login.vue")
const UserCenter = () => import("../views/user-center/Index.vue")
const UserProfile = () => import("../views/user-center/Profile.vue")
const UserSettings = () => import("../views/user-center/Settings.vue")

const routeConfig =[
    {
        path:'/',
        redirect:'/login'
    },
    {
        path:'/login',
        component:Login
    },
    {
        path:'/user',
        component:UserCenter,
        redirect:'/user/profile',
        children:[
            {
                path:'profile',
                component:UserProfile
            },
            {
                path:'settings',
                component:UserSettings
            }
        ]
    }
]

const router = createRouter({
    history: createMemoryHistory(),
    routes: routeConfig
})

export default router